<?php
namespace app\model;
use app\BaseModel;
use think\model\concern\SoftDelete;
use app\console\model\Admin;

class LeasingCompany extends BaseModel
{

    use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = '0000-00-00 00:00:00';
    protected $hidden = ['update_time','delete_time','sort','status'];



//
    public function searchCompanyIdAttr($query, $value, $data)
    {
        if (!empty($value)) {
            $query->where('company_id', '=', $value);
        }
    }



    protected function setAdminerIdAttr($value,$data){ //当前字段的修改器
         $this->set('login_account',Admin::where('id',$value)->value('admin_name'));
         $this->set('login_password',Admin::where('id',$value)->value('admin_password'));
         return $value;
    }

    protected function setCompanyIdAttr($value,$data){ //当前字段的修改器
        $this->set('title',self::where('id',$value)->value('title') ?? '');
        return $value;
    }



}